Afternoon all,
I use the example code below and nothing happens. I
printed the persist.UserData[1] array to console and its
empty. When I hard code 'speed = 12000' everything
hardware wise works as it should and my VFD drive goes to
the appropriate HZ (in this case 200hz).
What am I missing? When and where is persist.UserData[1]
updated with the current Gcode Speed value? Is this
something I have to add somewhere else? I don't see any
sign of it in any of the default config files either.
main()
{
float speed = *(float *)&persist.UserData[1]; //
value stored is actually a float
printf("speed=%f
UserData1=%f\n",speed,persist.UserData[1]);
FPGA(KAN_TRIG_REG)=4; // Mux PWM0 to JP7
Pin5 IO 44 for KSTEP
SetBitDirection(44,1); // define bit as an
output
FPGA(IO_PWMS_PRESCALE) = 46; // divide clock by
46 (1.4 KHz)
FPGA(IO_PWMS+1) = 1; // Enable
FPGA(IO_PWMS) = CorrectAnalog(speed/RPM_FACTOR);
// Set PWM
}
If i do this everything works hardware wise. So all my
connections are good.
main()
{
float speed = *(float *)&persist.UserData[1]; //
value stored is actually a float
printf("speed=%f
UserData1=%f\n",speed,persist.UserData[1]);
speed = 12000;
printf("speed=%f\n,speed);
FPGA(KAN_TRIG_REG)=4; // Mux PWM0 to JP7
Pin5 IO 44 for KSTEP
SetBitDirection(44,1); // define bit as an
output
FPGA(IO_PWMS_PRESCALE) = 46; // divide clock by
46 (1.4 KHz)
FPGA(IO_PWMS+1) = 1; // Enable
FPGA(IO_PWMS) = CorrectAnalog(speed/RPM_FACTOR);
// Set PWM
}